-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: change timepoint interpretation #897
feat!: change timepoint interpretation #897
Conversation
Adapting block.timepoint to the new form also adapts withdrawal_block_timepoint, deposit_block_timepoint, and stake_block_timepoint, which must all be equal to block.timepoint.
The global state should have the last_finalized_timepoint equal to the input.since, do not add the finality_time_in_ms.
3719abe
to
24624ad
Compare
@@ -303,6 +321,20 @@ pub fn unlock_to_owner( | |||
})) | |||
} | |||
|
|||
fn is_v1_withdrawal_cell(withdrawal_cell: &CellInfo) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn is_v1_withdrawal_cell(withdrawal_cell: &CellInfo) -> bool { | |
fn is_block_finalized_withdrawal_cell(withdrawal_cell: &CellInfo) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"is_block_finalized_withdrawal_cell" is more confusing for me. How about "is_legacy_withdrawal_cell"?
use gw_types::packed::RollupConfig; | ||
use gw_types::prelude::*; | ||
|
||
pub fn block_timepoint( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub fn block_timepoint( | |
pub fn finalized_timepoint( |
@zeroqn @sopium I will send another PR to rename structures after merging this PR. |
The PR brings two major changes:
The interpretation of both the block timepoint change from occurance block timestamp to future finalized timestamp, as well the global state last finalized timepoint change from last finalized timestamp to current timestamp.
You can see the differences via diff:
Note that
WithdrawalLockArgs.withdrawal_block_timepoint
,CustodianLockArgs.deposit_block_timepoint
andStakeLockArgs.stake_block_timepoint
is also block timepoint.Check v2 withdrawal cell finality based on input since.
Without replying
GlobalState
, or say rollup_state_cell, we still can check a v2 withdrawal cell finality based on input since, so that avoid celldep-race issue.Proposal for further changes:
Timepoint::BlockNumber
toTimepoint::Lagecy
,Timepoint::Timestamp
toTimepoint::New
GlobalState.lats_finalized_timepoint
,WithdrawalLockArgs.withdrawal_block_timepoint
,CustodianLockArgs.deposit_block_timepoint
andStakeLockArgs.stake_block_timepoint
.This PR will not make these changes, since I am having some problems bumping gw-types in the "develop" branch.